class Eva:
    m = {}
    l = []
    p = 0.5

    def __init__(self):
        m = {}
        l = []
        p = 0.5

    def push(self, s):
        if s not in self.m or self.m[s] + 1 < (len(self.l) + 1) * self.p:
            if s in self.m:
                self.m[s] += 1
            else:
                self.m[s] = 1
            self.l.append(s)
            return True
        else:
            return False

    def out(self):
        for i in self.l:
            print(i, end=" ")
        print()


e = Eva()
pl = ["123", "123", "123", "124", "2343", "23532"]
for i in pl:
    if e.push(i):
        print(i)
    else:
        print("hh")
e.out()